#!/usr/bin/envpython
# -*-coding:UTF-8-*-
'''
@File    :   update_batch_department.py
@Contact :   308711822@qq.com
@License :   (C) Copyright 2021-2225, Personal exclusive right.

@Modify Time      @Author    @Version    @Desciption
------------      -------    --------    -----------
2023/5/30 15:38   小钟同学      1.0         None
'''
from typing import List

from infirmary_admin_src.infirmary_common.infirmary_controller import IBaseController
from infirmary_admin_src.infirmary_common.infirmary_controller.rest_controller_with_depends import \
    RestControllerWithDepends
from fastapi import Request, Depends, Path, Body

from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.infirmary.businesses.schemas import SchemaBase
from infirmary_admin_src.infirmary_smart_admin.infirmary_biz.system.employee.services import EmployeeBusinesses



class XParam(SchemaBase):
    '''
    账号密码登录参数
    '''
    department_id: int = Body(None, alias='departmentId', title="departmentId", description='权限类型')
    employee_id_list: list[int] = Body(False, alias='employeeIdList', title="employeeIdList", description='是否禁用标记')


class IController(IBaseController):
    '''
    定制相关约束检测函数逻辑步序
    '''

    def __init__(self, *, request: Request,
                 schema_param: XParam,
                 ):
        super().__init__(request=request)
        # 入参参数
        # 入参参数
        self.schema_param = schema_param


@RestControllerWithDepends()
class SystemEmployeeBatchdepartmentController(IController):

    def business_login(self):
        pass
        # 查询用户信息，联表查询比较麻烦
        #  **{**self.schema_param.dict(exclude_unset=True, exclude={'is_trusted'}),
        result = EmployeeBusinesses.edit_sys_employee_update_batch_department(
            department_id=self.schema_param.department_id,
            employee_id_lists = self.schema_param.employee_id_list,
        )
        if result:
            self.response_msg = '更新成功'
        else:
            self.response_ok = False
            self.response_msg = '更新失败'
            return None

        return None
